<?php
$db = db::getInstance();
$name = new InputTypeSimpleModel();
$input = InputTypeSimpleModel::findByFilter($db, $name);

$avance = new InputTypeAvanceModel();
$get_avance = InputTypeAvanceModel::findByFilter($db, $avance);

$namef = new DonneesModel();
$get_name = DonneesModel::findByFilter($db, $namef);
?>

<html>
    <head>

        <!-- include style css -->
        <link rel="stylesheet" href="../views/css/validationEngine.jquery.css" type="text/css"/>
        <link rel="stylesheet" href="../views/css/style_menu.css" type="text/css"/>
        <link rel="stylesheet" href="../views/css/mini3537.css" type="text/css"/>
        <link rel="stylesheet" href="../views/css/template.css" type="text/css"/>
        <link rel="stylesheet" href="../views/css/mini74d5.css" type="text/css"/>
        <link rel="stylesheet" href="../views/css/reset.css" type="text/css" media="screen" title="no title" charset="utf-8">
        <link rel="stylesheet" href="../views/css/demo.css" type="text/css" media="screen" title="no title" charset="utf-8">
        <link rel="stylesheet" href="../views/css/simplemodal.css" type="text/css" media="screen" title="no title" charset="utf-8">
        <link rel="icon" type="image/png" href="../views/image/dynamic_form.png" />

        <!-- include script js -->
        <script type="text/javascript" src="../views/js/jquery-1.6.min.js"></script>
        <script type="text/javascript" src="../views/js/ddaccordion.js"></script>
        <script type="text/javascript" src="../views/js/menu.js"></script>
        <script src="../views/js/mootools-core-1.3.1.js" type="text/javascript" charset="utf-8"></script>
        <script src="../views/js/mootools-more-1.3.1.1.js" type="text/javascript" charset="utf-8"></script>
        <script src="../views/js/simple-modal.js" type="text/javascript" charset="utf-8"></script>
        <script src="../views/js/notifier.js" type="text/javascript" charset="utf-8"></script>
        <script type="text/javascript" src="../views/js/gf_scroll_div.js"></script>
        <script type="text/javascript" src="../views/js/jquery-ui-1.8.18.custom.min.js"></script>
        <script type="text/javascript" src="../views/js/drop.js"></script>
        <script src="../views/js/modernizr.custom.min.js" type="text/javascript" charset="utf-8"></script>
       <!-- <script src="../views/js/sort.js" type="text/javascript" charset="utf-8"></script>
-->
        

        <!-- script des fonctions-->
        <script>
        
            var t=0;
            var c=0;
            var r=0;
            var b=0;
            var co=0;
            var cox=0;
            var comb=0;
            var m=0;
            var d=0;
            var f=0;
            var ta=0;
            var verrou=0;
            var id_s=0;
            
            var cpt_edit_txt=0;
            var cpt_edit_chk=0;
            var cpt_edit_area=0;
            var cpt_edit_radio=0;
            var cpt_edit_cond=0;
            var cpt_edit_comb=0;
            var cpt_edit_mail=0;
            var cpt_edit_date=0;
            var cpt_edit_break=0;
            var cpt_edit_id_s=0;
            
            //compteur des champs 
            var cpt_text;
            var cpt_radio;
            var cpt_checkbox;
            var cpt_area;
            var cpt_matrice;
            var cpt_cond;
            var cpt_comb;
            var cpt_mail;
            var cpt_date;
            var cpt_form;
            var cpt_break;
            var cpt_id_s;        
            
            $(document).ready(function(){
              
              //style affichage barre
               $(".clearfix").live("mouseover",function()
               {
                   $(this).attr("style","opacity: 1");
               });
                 $(".clearfix").live("mouseout",function()
               {
                   $(this).attr("style","opacity: 0.5");
               });
               
            // sort
            $(function(){
            $(".sortable").sortable({                                             
            tolerance: 'pointer',
            revert: 300,
	    delay: 100,
	    opacity: 0.7,
            zIndex:10000
           
            })
            });
                
                ////////////////////// drag and drop //////////////////////////////////////
              
              
                // drag the text 
                $(".dragtext").mouseover(function () {                        
                    $(".dragtext" ).draggable({
                        revert: true           
                            
                    });                                 
                    $("#c").droppable({
                        accept: ".dragtext",
                        drop: function () {                           
                            t++;
                            var sourcetxt=$("#text").html();
                            sourcetxt=sourcetxt.replace("id_div_txt","id_div_txt"+t);
                            sourcetxt=sourcetxt.replace("text_id","text_id"+t);
                            sourcetxt=sourcetxt.replace("text_name","text_name"+t);
                            sourcetxt=sourcetxt.replace("boutton_edit_text","boutton_edit_text"+t);
                            sourcetxt=sourcetxt.replace("label_txt","label_txt"+t);
                            sourcetxt=sourcetxt.replace("grey-bg","grey-bg champ");
                            $(".source_interface").append(sourcetxt);
                            $("#label_txt"+t).attr("class","voir");
                            $("#text_id"+t).attr("class","voir");                            
                        }
                    });
              
                });
                
                //drag radio 
                $(".dragradio").mouseover(function() {
                    $(".dragradio" ).draggable({
                        revert: true                         
                    
                    });
                    $("#c").droppable({
                        accept: ".dragradio",
                        drop: function() {                           
                            r++;
                            var sourcetxt=$("#radio").html();
                            sourcetxt=sourcetxt.replace("id_div_radio","id_div_radio"+r);
                            sourcetxt=sourcetxt.replace("radio_id","radio_id"+r);
                            sourcetxt=sourcetxt.replace("radio_name","radio_name"+r);
                            sourcetxt=sourcetxt.replace("label_radio","label_radio"+r);
                            sourcetxt=sourcetxt.replace("grey-bg","grey-bg champ");
                            $(".source_interface").append(sourcetxt);
                            $("#label_radio"+r).attr("class","voir");
                            $("#radio_id"+r).attr("class","voir");
                            
                        }
                    });
                });                
                //drag checkbox
                $(".dragcheckbox").mouseover(function() {                   
                    $(".dragcheckbox" ).draggable({
                        revert: true                
                    });
                    $("#c").droppable({
                        accept: ".dragcheckbox",
                        drop: function() {                           
                            c++;
                            var sourcetxt=$("#checkbox").html();
                            sourcetxt=sourcetxt.replace("id_div_checkbox","id_div_checkbox"+c);
                            sourcetxt=sourcetxt.replace("checkbox_id","checkbox_id"+c);
                            sourcetxt=sourcetxt.replace("checkbox_name","checkbox_name"+c);
                            sourcetxt=sourcetxt.replace("label_checkbox","label_checkbox"+c);
                            sourcetxt=sourcetxt.replace("grey-bg","grey-bg champ");
                            $(".source_interface").append(sourcetxt);
                            $("#label_checkbox"+c).attr("class","voir");
                            $("#checkbox_id"+c).attr("class","voir");
                            
                        }
                    });
                
                });
                
                //drag break
                $(".dragbreak").mouseover(function() {                    
                    $(".dragbreak" ).draggable({
                        revert: true                     
          
                    });
                    $("#c").droppable({
                        accept: ".dragbreak",
                        drop: function() {                      
                            b++;
                            var sourcetxt=$("#break").html();
                            sourcetxt=sourcetxt.replace("id_div_break","id_div_break"+b);
                            sourcetxt=sourcetxt.replace("input_break","input_break"+b);
                            sourcetxt=sourcetxt.replace("label_break","label_break"+b);
                            sourcetxt=sourcetxt.replace("grey-bg","grey-bg champ");
                            $(".source_interface").append(sourcetxt);
                            $("#label_break"+b).attr("class","voir");
                            $("#break_id"+b).attr("class","voir");
                            
                        }
                    });                
                });
                
                //drag combo
                $(".dragcombo_boxes").mouseover(function() {                    
                    $(".dragcombo_boxes" ).draggable({
                        revert: true                       
                    });
                    $("#c").droppable({
                        accept: ".dragcombo_boxes",
                        drop: function() {
                      
                            comb++;
                            var sourcetxt=$("#combo").html();
                            sourcetxt=sourcetxt.replace("id_div_combo","id_div_combo"+comb);
                            sourcetxt=sourcetxt.replace("combo_id","combo_id"+comb);
                            sourcetxt=sourcetxt.replace("combo_name","combo_name"+comb);
                            sourcetxt=sourcetxt.replace("boutton_edit_combo","boutton_edit_combo"+comb);
                            sourcetxt=sourcetxt.replace("label_combo","label_combo"+comb);
                            sourcetxt=sourcetxt.replace("grey-bg","grey-bg champ");
                            $(".source_interface").append(sourcetxt);
                            $("#label_combo"+comb).attr("class","voir");
                            $("#combo_id"+comb).attr("class","voir");
                            
                        }
                    });                
                });
              
                //drag textaera
                $(".dragtextarea").mouseover(function() {                    
                    $(".dragtextarea" ).draggable({
                        revert: true  
                    });
                    $("#c").droppable({
                        accept: ".dragtextarea",
                        drop: function() {               
                            ta++;
                            var sourcetxt=$("#txtarea").html();
                            sourcetxt=sourcetxt.replace("id_div_txtarea","id_div_txtarea"+ta);
                            sourcetxt=sourcetxt.replace("area_id","area_id"+ta);
                            sourcetxt=sourcetxt.replace("area_name","area_name"+ta);
                            sourcetxt=sourcetxt.replace("boutton_edit_area","boutton_edit_area"+ta);
                            sourcetxt=sourcetxt.replace("label_area","label_area"+ta);
                            sourcetxt=sourcetxt.replace("grey-bg","grey-bg champ");
                            $(".source_interface").append(sourcetxt);
                            $("#label_area"+ta).attr("class","voir");
                            $("#area_id"+ta).attr("class","voir");
                                              
                        }
                    });                
                });                
                //drag condition
                $(".dragcondition").mouseover(function() {                    
                    $(".dragcondition" ).draggable({
                        revert: true  
                    });
                    $("#c").droppable({
                        accept: ".dragcondition",
                        drop: function() {                   
                            co++;          
                            cox++;
                            var sourcetxt=$("#conditionnel").html();
                            sourcetxt=sourcetxt.replace("id_div_cond","id_div_cond"+co);
                            sourcetxt=sourcetxt.replace("cond_id","cond_id"+co);
                            sourcetxt=sourcetxt.replace("cond_name","cond_name"+co);
                            sourcetxt=sourcetxt.replace("label_cond","label_cond"+co);
                            sourcetxt=sourcetxt.replace("edit_show_cond","edit_show_cond"+co);
                            sourcetxt=sourcetxt.replace("grey-bg","grey-bg champ");
                            $(".source_interface").append(sourcetxt);
                            $("#label_cond"+co).attr("class","voir");
                            $("#cond_id"+co).attr("class","voir");
                            $("#label_cond"+co).attr("num",co);
                            $("#cond_id"+co).attr("num",co);                 
                         
                        }
                    });                
                });
                
                //drag date
                $(".dragDate").mouseover(function() {                    
                    $(".dragDate" ).draggable({
                        revert: true  
                    });
                    $("#c").droppable({
                        accept: ".dragDate",
                        drop: function() {   
                            d++;
                            var sourcetxt=$("#date").html();
                            sourcetxt=sourcetxt.replace("id_div_date","id_div_date"+d);
                            sourcetxt=sourcetxt.replace("date_id","date_id"+d);
                            sourcetxt=sourcetxt.replace("date_name","date_name"+d);
                            sourcetxt=sourcetxt.replace("boutton_edit_date","boutton_edit_date"+d);
                            sourcetxt=sourcetxt.replace("label_date","label_date"+d);
                            sourcetxt=sourcetxt.replace("grey-bg","grey-bg champ");
                            $(".source_interface").append(sourcetxt);
                            $("#label_date"+d).attr("class","voir");
                            $("#date_id"+d).attr("class","voir");
                     
                        }
                    });                
                });
                //drag mail
                $(".dragE-mail").mouseover(function() {                    
                    $(".dragE-mail" ).draggable({
                        revert: true  
                    });
                    $("#c").droppable({
                        accept: ".dragE-mail",
                        drop: function() {   
                            m++;
                            var sourcetxt=$("#email").html();
                            sourcetxt=sourcetxt.replace("id_div_mail","id_div_mail"+m);
                            sourcetxt=sourcetxt.replace("mail_id","mail_id"+m);
                            sourcetxt=sourcetxt.replace("mail_name","mail_name"+m);
                            sourcetxt=sourcetxt.replace("boutton_edit_mail","boutton_edit_mail"+m);
                            sourcetxt=sourcetxt.replace("label_mail","label_mail"+m);
                            sourcetxt=sourcetxt.replace("grey-bg","grey-bg champ");
                            $(".source_interface").append(sourcetxt);
                            $("#label_mail"+m).attr("class","voir");
                            $("#mail_id"+m).attr("class","voir");
                     
                        }
                    });                
                });
                
                //drag form
                $(".dragformulaire").mouseover(function() {                    
                    $(".dragformulaire" ).draggable({
                        revert: true  
                    });
                    $("#c").droppable({
                        accept: ".dragformulaire",
                        drop: function() {   
                            f++;
                            var sourcetxt=$("#form").html();
                            sourcetxt=sourcetxt.replace("id_div_form","id_div_form"+f);
                                         
                            sourcetxt=sourcetxt.replace("label_form","label_form"+f);
                            sourcetxt=sourcetxt.replace("grey-bg","grey-bg champ");
                            sourcetxt=sourcetxt.replace("form_select","form_select voir");
                            $(".source_interface").append(sourcetxt);
                            $("#label_form"+f).attr("class","voir");
                     
                        }
                    });                
                });
           
                //drag select avance
                $(".dragid_selector").mouseover(function() {                    
                    $(".dragid_selector" ).draggable({
                        revert: true  
                    });
                    $("#c").droppable({
                        accept: ".dragid_selector",
                        drop: function() {   
                            id_s++;
                            var sourcetxt=$("#id_select").html();
                            sourcetxt=sourcetxt.replace("id_div_id_select","id_div_id_select"+id_s);
                            sourcetxt=sourcetxt.replace("id_select_id","id_select_id"+id_s);                   
                            sourcetxt=sourcetxt.replace("label_id_select","label_id_select"+id_s);
                            sourcetxt=sourcetxt.replace("table_menu","table_menu"+id_s);
                            sourcetxt=sourcetxt.replace("colone_menu","colone_menu"+id_s);                    
                            sourcetxt=sourcetxt.replace("grey-bg","grey-bg champ");
                            $(".source_interface").append(sourcetxt);
                            $("#label_id_select"+id_s).attr("class","voir");
                            $("#table_menu"+id_s).attr("class","table_select voir");
                            $("#colone_menu"+id_s).attr("class","colone_select voir");
                     
                        }
                    });                
                });
              
                ////////////////////////////////////////////////AJOUT SIMPLE DES INPUTES ////////////////////////////                
                
                // ajouter le text 
                $("#Create_input_text").click(function (){
                    t++;                    
                    var sourcetxt=$("#text").html();
                    sourcetxt=sourcetxt.replace("id_div_txt","id_div_txt"+t);
                    sourcetxt=sourcetxt.replace("text_id","text_id"+t);
                    sourcetxt=sourcetxt.replace("text_name","text_name"+t);
                    sourcetxt=sourcetxt.replace("boutton_edit_text","boutton_edit_text"+t);
                    sourcetxt=sourcetxt.replace("label_txt","label_txt"+t);
                    sourcetxt=sourcetxt.replace("grey-bg","grey-bg champ");
                    $(".source_interface").append(sourcetxt);
                    $("#label_txt"+t).attr("class","voir");
                    $("#text_id"+t).attr("class","voir");
                });
                
                // ajouter le break
                $("#Create_input_break").click(function(){
                    b++;
                    var sourcetxt=$("#break").html();
                    sourcetxt=sourcetxt.replace("id_div_break","id_div_break"+b);
                    sourcetxt=sourcetxt.replace("input_break","input_break"+b);
                    sourcetxt=sourcetxt.replace("label_break","label_break"+b);
                    sourcetxt=sourcetxt.replace("grey-bg","grey-bg champ");
                    $(".source_interface").append(sourcetxt);
                    $("#label_break"+b).attr("class","voir");
                    $("#break_id"+b).attr("class","voir");
                });
				
                // ajouter combo boxe
                $("#Create_input_combo_boxes").click(function(){
                    comb++;
                    var sourcetxt=$("#combo").html();
                    sourcetxt=sourcetxt.replace("id_div_combo","id_div_combo"+comb);
                    sourcetxt=sourcetxt.replace("combo_id","combo_id"+comb);
                    sourcetxt=sourcetxt.replace("combo_name","combo_name"+comb);
                    sourcetxt=sourcetxt.replace("boutton_edit_combo","boutton_edit_combo"+comb);
                    sourcetxt=sourcetxt.replace("label_combo","label_combo"+comb);
                    sourcetxt=sourcetxt.replace("grey-bg","grey-bg champ");
                    $(".source_interface").append(sourcetxt);
                    $("#label_combo"+comb).attr("class","voir");
                    $("#combo_id"+comb).attr("class","voir");
                });
                
                // ajouter id_selector
                $("#Create_input_id_selector").click(function(){
                    id_s++;
                    var sourcetxt=$("#id_select").html();
                    sourcetxt=sourcetxt.replace("id_div_id_select","id_div_id_select"+id_s);
                    sourcetxt=sourcetxt.replace("id_select_id","id_select_id"+id_s);                   
                    sourcetxt=sourcetxt.replace("label_id_select","label_id_select"+id_s);
                    sourcetxt=sourcetxt.replace("table_menu","table_menu"+id_s);
                    sourcetxt=sourcetxt.replace("colone_menu","colone_menu"+id_s);                    
                    sourcetxt=sourcetxt.replace("grey-bg","grey-bg champ");
                    $(".source_interface").append(sourcetxt);
                    $("#label_id_select"+id_s).attr("class","voir");                   
                    $("#table_menu"+id_s).attr("class","table_select voir");
                    $("#colone_menu"+id_s).attr("class","colone_select voir");
                });

                //ajouter checkbox
                $("#Create_input_checkbox").click(function(){
                    c++;
                    var sourcetxt=$("#checkbox").html();
                    sourcetxt=sourcetxt.replace("id_div_checkbox","id_div_checkbox"+c);
                    sourcetxt=sourcetxt.replace("checkbox_id","checkbox_id"+c);
                    sourcetxt=sourcetxt.replace("checkbox_name","checkbox_name"+c);
                    sourcetxt=sourcetxt.replace("label_checkbox","label_checkbox"+c);
                    sourcetxt=sourcetxt.replace("grey-bg","grey-bg champ");
                    $(".source_interface").append(sourcetxt);
                    $("#label_checkbox"+c).attr("class","voir");
                    $("#checkbox_id"+c).attr("class","voir");
                });

                //ajouter radio 
                $("#Create_input_radio").click(function(){
                    r++;
                    var sourcetxt=$("#radio").html();
                    sourcetxt=sourcetxt.replace("id_div_radio","id_div_radio"+r);
                    sourcetxt=sourcetxt.replace("radio_id","radio_id"+r);
                    sourcetxt=sourcetxt.replace("radio_name","radio_name"+r);
                    sourcetxt=sourcetxt.replace("label_radio","label_radio"+r);
                    sourcetxt=sourcetxt.replace("grey-bg","grey-bg champ");
                    $(".source_interface").append(sourcetxt);
                    $("#label_radio"+r).attr("class","voir");
                    $("#radio_id"+r).attr("class","voir");
                });
              
                // ajouter une condition 
                $("#Create_input_Condition").click(function(){
                    co++;          
                    cox++;
                    var sourcetxt=$("#conditionnel").html();
                    sourcetxt=sourcetxt.replace("id_div_cond","id_div_cond"+co);
                    sourcetxt=sourcetxt.replace("cond_id","cond_id"+co);
                    sourcetxt=sourcetxt.replace("cond_name","cond_name"+co);
                    sourcetxt=sourcetxt.replace("label_cond","label_cond"+co);
                    sourcetxt=sourcetxt.replace("edit_show_cond","edit_show_cond"+co);
                    sourcetxt=sourcetxt.replace("grey-bg","grey-bg champ");
                    $(".source_interface").append(sourcetxt);
                    $("#label_cond"+co).attr("class","voir");
                    $("#cond_id"+co).attr("class","voir");
                    $("#label_cond"+co).attr("num",co);
                    $("#cond_id"+co).attr("num",co);
                });
                
                // ajouter champ mail 
                $("#Create_input_E-mail").click(function(){
                    m++;
                    var sourcetxt=$("#email").html();
                    sourcetxt=sourcetxt.replace("id_div_mail","id_div_mail"+m);
                    sourcetxt=sourcetxt.replace("mail_id","mail_id"+m);
                    sourcetxt=sourcetxt.replace("mail_name","mail_name"+m);
                    sourcetxt=sourcetxt.replace("boutton_edit_mail","boutton_edit_mail"+m);
                    sourcetxt=sourcetxt.replace("label_mail","label_mail"+m);
                    sourcetxt=sourcetxt.replace("grey-bg","grey-bg champ");
                    $(".source_interface").append(sourcetxt);
                    $("#label_mail"+m).attr("class","voir");
                    $("#mail_id"+m).attr("class","voir");
                });
                
                // ajouter Date
                $("#Create_input_Date").click(function(){
                    d++;
                    var sourcetxt=$("#date").html();
                    sourcetxt=sourcetxt.replace("id_div_date","id_div_date"+d);
                    sourcetxt=sourcetxt.replace("date_id","date_id"+d);
                    sourcetxt=sourcetxt.replace("date_name","date_name"+d);
                    sourcetxt=sourcetxt.replace("boutton_edit_date","boutton_edit_date"+d);
                    sourcetxt=sourcetxt.replace("label_date","label_date"+d);
                    sourcetxt=sourcetxt.replace("grey-bg","grey-bg champ");
                    $(".source_interface").append(sourcetxt);
                    $("#label_date"+d).attr("class","voir");
                    $("#date_id"+d).attr("class","voir");
                    
                });
                          
                // ajouter textarea
                $("#Create_input_textarea").click(function(){
                    ta++;
                    var sourcetxt=$("#txtarea").html();
                    sourcetxt=sourcetxt.replace("id_div_txtarea","id_div_txtarea"+ta);
                    sourcetxt=sourcetxt.replace("area_id","area_id"+ta);
                    sourcetxt=sourcetxt.replace("area_name","area_name"+ta);
                    sourcetxt=sourcetxt.replace("boutton_edit_area","boutton_edit_area"+ta);
                    sourcetxt=sourcetxt.replace("label_area","label_area"+ta);
                    sourcetxt=sourcetxt.replace("grey-bg","grey-bg champ");
                    $(".source_interface").append(sourcetxt);
                    $("#label_area"+ta).attr("class","voir");
                    $("#area_id"+ta).attr("class","voir");
                    
                });           
                // ajouter form
                $("#Create_input_formulaire").click(function(){
                    f++;
                    var sourcetxt=$("#form").html();
                    sourcetxt=sourcetxt.replace("id_div_form","id_div_form"+f);
                                         
                    sourcetxt=sourcetxt.replace("label_form","label_form"+f);
                    sourcetxt=sourcetxt.replace("grey-bg","grey-bg champ");
                    sourcetxt=sourcetxt.replace("form_select","form_select voir");
                    $(".source_interface").append(sourcetxt);
                    $("#label_form"+f).attr("class","voir");
                   
                    
                });
                
                //////////////////////////////////////SUPPRIMER REDUIRE LES CHAMPS AJOUTER ////////////////////////////////////////////////
                   
                //Supprimer
                $("#supprimer").live("click",function(){
                    
                 
                    // pour garentir que les id champ cond nentre pas en confusion
                    if ($(this).parent('div').attr("class")=="text_champ")
                    {
                        t--;   
                        cpt_text--;
                    }
                    if ($(this).parent('div').attr("class")=="break_champ")
                    {
                        b--;   
                        cpt_break--;
                    }
                    else if ($(this).parent('div').attr("class")=="radio_champ")
                    {
                        r--;
                        cpt_radio--;
                    }
                    else if ($(this).parent('div').attr("class")=="form_champ")
                    {
                        f--;
                    }
                    else if ($(this).parent('div').attr("class")=="area_champ")
                    {
                        ta--;
                        cpt_area--;
                    }
                    else if ($(this).parent('div').attr("class")=="combo_champ")
                    {
                        comb--;
                        cpt_comb--;
                    }
                    else if ($(this).parent('div').attr("class")=="checkbox_champ")
                    {
                        c--;
                        cpt_checkbox--;
                    }
                    else if ($(this).parent('div').attr("class")=="date_champ")
                    {
      
                        cpt_date--;
                        d--;
                    }
                    else if ($(this).parent('div').attr("class")=="mail_champ")
                    {
                        m--;
                        cpt_mail--;
                    }  
                    else if ($(this).parent('div').attr("class")=="id_select_champ")
                    {
                        id_s--;
                        cpt_id_s--;
                    }  
                    
                    ////////////////////si cest une condition (long traitement) //////////////////////////             
                    else if ($(this).parent('div').attr("class")=="champ_cond")
                    {
                        co--;
                        cpt_cond--;
                    
                        if (($(this).parent('div').parent('fieldset').parent('div').attr("id"))=="conditions")
                        
                        {
                            $("#source").attr("class","");
                            $(this).parent('div').parent('fieldset').parent('div').attr("class","source_interface");
                        }
                        else
                        {
                            $("#source").attr("class","source_interface");
                        }
                    
                        //retourner lajout normal 
                        $('#id_div_txt').children('label').attr("cond","");                                      
                        $('#id_div_txt').children(':input').attr("cond","");  
                        $('#id_div_checkbox').children('label').attr("cond","");
                        $('#id_div_checkbox').children(':input').attr("cond","");
                        $('#id_div_radio').children('label').attr("cond","");
                        $('#id_div_radio').children(':input').attr("cond","");
                        $('#id_div_combo').children('label').attr("cond","");
                        $('#id_div_combo').children(':input').attr("cond","");
                        $('#id_div_mail').children('label').attr("cond","");
                        $('#id_div_mail').children(':input').attr("cond","");
                        $('#id_div_date').children('label').attr("cond","");
                        $('#id_div_date').children(':input').attr("cond","");
                        $('#id_div_form').children('label').attr("cond","");
                        $('#id_div_cond').children(':input').attr("cond","");
                        $('#id_div_cond').children('label').attr("cond","");
                        $('#id_div_txtarea').children(':input').attr("cond","");
                        $('#id_div_txtarea').children('label').attr("cond","");
                        $('#id_div_break').children('label').attr("cond","");
                        $('#id_div_id_select').children('label').attr("cond","");
                        $('#id_div_id_select').children('input').attr("cond","");
                        $('#id_div_id_select').children(':input:eq(1)').attr("cond","");
               
                        // suppression des champs a linterieur du champ conditionnel + conservation de l'ordre des cpt
                        $(".champ").each(function(){  
                            if (($(this).children("div").children(':input').attr("cond"))==("cond_champ"+($(this).parent('div').parent('div').children('label').attr("num"))))
                            {
                                if ($(this).children('div').attr('class')=="text_champ")
                                {
                                    t--;
                                }
                                else if ($(this).children('div').attr('class')=="radio_champ")
                                {
                                    r--;
                                }
                                else if ($(this).children('div').attr('class')=="checkbox_champ")
                                {
                                    c--;
                                }
                                else if ($(this).children('div').attr('class')=="combo_champ")
                                {
                                    comb--;   
                                }
                                else if ($(this).children('div').attr('class')=="mail_champ")
                                {
                                    m--;
                                }
                                else if ($(this).children('div').attr('class')=="date_champ")
                                {
                                    d--;
                                }
                                else if ($(this).children('div').attr('class')=="form_champ")
                                {
                                    f--;
                                }
                                else if ($(this).children('div').attr('class')=="champ_cond")
                                {
                                    co--;
                                }
                                else if ($(this).children('div').attr('class')=="area_champ")
                                {
                                    ta--;
                                }
                                else if ($(this).children('div').attr('class')=="break_champ")
                                {
                                    b--;
                                }
                                else if ($(this).children('div').attr('class')=="id_select_champ")
                                {
                                    id_s--;
                        
                                } 
                            }
                        });
                    }
                                
                    $(this).parents("fieldset:first").remove();
                });

                //reduire
                $("#reduire").live("click",function () {
                    verrou=0;
                    $(this).parent("div").children('div:first').html("");
                });

                /////////////////////////////////////////////////INTERFACE LIEE AU BOUTON EDITER ///////////////////

                //editionner le text 
                $(".button_edit_text").live("click",function(){
                    if (verrou==0)
                    {
                        cpt_edit_txt++;
                        var sourcetxt=$("#interface_edit_txt").html();
                        sourcetxt=sourcetxt.replace("source_taille","source_taille"+cpt_edit_txt);
                        sourcetxt=sourcetxt.replace("source_label_text","source_label_text"+cpt_edit_txt);
                        sourcetxt=sourcetxt.replace("source_nom_txt","source_nom_txt"+cpt_edit_txt);

                        $(this).parent("div:first").children("div").append(sourcetxt);
                        verrou=1;
                    }
                });

                //editionner le textarea 
                $(".button_edit_area").live("click",function(){
                    if (verrou==0)
                    {
                        cpt_edit_area++;
                        var sourcetxt=$("#interface_edit_area").html();
                        sourcetxt=sourcetxt.replace("source_label_area","source_label_area"+cpt_edit_area);
                        sourcetxt=sourcetxt.replace("source_cols_area","source_cols_area"+cpt_edit_area);
                        sourcetxt=sourcetxt.replace("source_rows_area","source_rows_area"+cpt_edit_area);                        
                        $(this).parent("div:first").children("div").append(sourcetxt);
                        verrou=1;
                    }
                });

                //editionner checkbox 
                $(".bouton_edit_checkbox").live("click",function(){
                    if (verrou==0)
                    {
                        cpt_edit_chk++;
                        var sourcetxt=$("#interface_edit_checkbox").html();
                        sourcetxt=sourcetxt.replace("source_label_checkbox","source_label_checkbox"+cpt_edit_chk);
                        sourcetxt=sourcetxt.replace("source_nom_checkbox","source_nom_checkbox"+cpt_edit_chk);
                        $(this).parent("div").children("div").append(sourcetxt);
                        verrou=1;
                    }
                });
                
                //editionner break 
                $(".button_edit_break").live("click",function(){
                    if (verrou==0)
                    {
                        cpt_edit_break++;
                        var sourcetxt=$("#interface_edit_break").html();
                        sourcetxt=sourcetxt.replace("source_label_break","source_label_break"+cpt_edit_break);
                        sourcetxt=sourcetxt.replace("source_nom_break","source_nom_break"+cpt_edit_break);
                        $(this).parent("div").children("div").append(sourcetxt);
                        verrou=1;
                    }
                });
			
                //editionner mail
                $(".bouton_edit_mail").live("click",function(){
                    if (verrou==0)
                    {
                        cpt_edit_mail++;
                        var sourcetxt=$("#interface_edit_mail").html();

                        sourcetxt=sourcetxt.replace("source_label_mail","source_label_mail"+cpt_edit_mail);
                        sourcetxt=sourcetxt.replace("source_nom_mail","source_nom_mail"+cpt_edit_mail);
                        $(this).parent("div").children("div").append(sourcetxt);
                        verrou=1;
                    }
                });         
                // editionner radio
                $(".boutton_edit_radio").live("click",function(){
                    if (verrou==0)
                    {
                        cpt_edit_radio++;
                        var sourcetxt=$("#interface_edit_radio").html();

                        sourcetxt=sourcetxt.replace("source_label_radio","source_label_radio"+cpt_edit_radio);
                        sourcetxt=sourcetxt.replace("source_nom_radio","source_nom_radio"+cpt_edit_radio);
                        $(this).parent("div").children("div").append(sourcetxt);
                        verrou=1;
                    }
                });
                
                // editionner date
                $(".button_edit_date").live("click",function(){
                    if (verrou==0)
                    {
                        cpt_edit_date++;                       
                        var sourcetxt=$("#interface_edit_date").html();
                        sourcetxt=sourcetxt.replace("source_label_date","source_label_date"+cpt_edit_date);
                        $(this).parent("div").children("div").append(sourcetxt);
                        verrou=1;
                    }
                });
                
                //editionner champ condition
                $(".bouton_edit_cond").live("click",function(){
                    if (verrou==0)
                    {
                        cpt_edit_cond++;
                        var sourcetxt=$("#interface_edit_cond").html();
                        sourcetxt=sourcetxt.replace("source_label_cond","source_label_cond"+cpt_edit_cond);
                        sourcetxt=sourcetxt.replace("source_nom_cond","source_nom_cond"+cpt_edit_cond);
                        $(this).parent("div").children("div:first").append(sourcetxt);
                        verrou=1;   
                    }
               
                });
            
                ///////***** appeler la fonction d'extration des formulaires /////////////////////////
                $(".call_forms").live("click",function(event){
         
                    event.preventDefault(); 
                    var name= ($(this).parent('div').children("select").val()); 
                    
                    if ($(this).parent('div').parent('fieldset').parent('div').attr("id")=="conditions")
                    {
                        var cond=($(this).parent('div').parent('fieldset').parent('div').parent('div').children('label').attr("num"));
                       
                    }
                    $.post("get_form_fields",{ nom_get :name,nb_t:t,nb_c:c,nb_r:r,nb_co:co,nb_comb:comb,nb_m:m,nb_d:d,nb_f:f,nb_ta:ta,condition:cond,nb_b:b,nb_s:id_s},
                   
                    function(data) {
                      
                        t=data["textnbr"];
                        c=data["checknbr"];
                        r=data["radionbr"];
                        co=data["condnbr"];
                        comb=data["combonbr"];
                        d=data["datenbr"];
                        m=data["mailnbr"];
                        ta=data["areanbr"];
                        b=data["break"];
                        id_s=data["select"];
                    
                        $(".source_interface").append(data['res']);
                        
                    },"json");
                   
                    $(this).parent('div').children('select').attr("disabled","disabled");
                });
                //////////////////////////////////////////////////////EDITION COMBO BOX ///////////////////////////////				
                
                //editionner le combo box 
                $(".button_edit_combo").live("click",function(){
                    if (verrou==0)
                    {
                        cpt_edit_comb++;
                        var sourcetxt=$("#interface_edit_combo").html();
    
                        sourcetxt=sourcetxt.replace("source_label_combo","source_label_combo"+cpt_edit_comb);
                        sourcetxt=sourcetxt.replace("source_nom_comb","source_nom_combo"+cpt_edit_comb);

                        $(this).parent("div:first").children("div").append(sourcetxt);
                        verrou=1;
                    }
                });
				
                // ajouter choix combo
				
                $(".add_combo").live("click",function(){
					 
                    var sourcetxt= $("#interface_added").html();
                    sourcetxt=sourcetxt.replace("oui","non");
                    $(this).parent("div").children("div").append(sourcetxt);
					 
                });
				
                //supprimer un choix combo deja ajouter
                $(".del_combo").live("click",function(){ 
                    var x=$(this).parent('div').parent('div').children('select').attr("id");
                    $("#"+x+" option:selected").remove();
                          
                });
                                       
                //Validation des modification comboboxes
                $(".valider_modif_combo").live("click",function(){  
                    var i=0; 
                    var source_label=$(this).parent("div").children(":input:first").val();	
                    $(this).parent("div").parent("div").children("label").text(source_label);

                    $(".added_combo").each(function(){	
                        if ($(this).attr("added")==("non"))	
                        {
                            $(this).parent('div').parent('div').parent('div').parent('div').children("select").append(new Option($(this).val()), true);
                            $(this).attr("added","oui")
                        }                        
                    });                   				  
                });
				
                // supprimer un champ text choix combo
                $(".min_combo").live("click",function(){ 		
                    $(this).parent('div').html("");                      
                });
                ///////////////////////////////////CODE POUR ACTIVER/DESACTIVER LAJOUT DUN SOUS FORMULAIRE/////////////////////////////////////////////////////
                
               
                //desaciver lajout normal et activer a la condition
                $(".Ajout_cond").live("click",function(){
                    $("#source").attr("class","");
                    $(this).parent('div').children('div:eq(1)').attr("class","source_interface");
                    cox=$(this).parent('div').children('label').attr("num");
                   
                    $('#id_div_txt').children('label').attr("cond","cond_champ"+cox);
                    $('#id_div_txt').children(':input').attr("cond","cond_champ"+cox); 
                    $('#id_div_checkbox').children('label').attr("cond","cond_champ"+cox);
                    $('#id_div_checkbox').children(':input').attr("cond","cond_champ"+cox);
                    $('#id_div_radio').children('label').attr("cond","cond_champ"+cox);
                    $('#id_div_radio').children(':input').attr("cond","cond_champ"+cox);
                    $('#id_div_combo').children('label').attr("cond","cond_champ"+cox);
                    $('#id_div_combo').children(':input').attr("cond","cond_champ"+cox);
                    $('#id_div_mail').children('label').attr("cond","cond_champ"+cox);
                    $('#id_div_mail').children(':input').attr("cond","cond_champ"+cox);
                    $('#id_div_date').children('label').attr("cond","cond_champ"+cox);
                    $('#id_div_date').children(':input').attr("cond","cond_champ"+cox);
                    $('#id_div_form').children('label').attr("cond","cond_champ"+cox);
                    $('#id_div_cond').children(':input').attr("cond","cond_champ"+cox);
                    $('#id_div_cond').children('label').attr("cond","cond_champ"+cox);
                    $('#id_div_txtarea').children(':input').attr("cond","cond_champ"+cox);
                    $('#id_div_txtarea').children('label').attr("cond","cond_champ"+cox);
                    $('#id_div_break').children('label').attr("cond","cond_champ"+cox);
                    $('#id_div_break').children(':input').attr("cond","cond_champ"+cox);
                    $('#id_div_id_select').children('label').attr("cond","cond_champ"+cox);
                    $('#id_div_id_select').children(':input').attr("cond","cond_champ"+cox);
                    $('#id_div_id_select').children(':input:eq(1)').attr("cond","cond_champ"+cox);                    

                    
                    // si condition sous une autre condition -> desactivé parent :
                    if ($(this).parent('div').parent('fieldset').parent('div').attr("class")=="source_interface")
                    {
                        $(this).parent('div').parent('fieldset').parent('div').attr("class","")
                    }
                    
                });
                
                //retour a letat normal
                $(".desactiver_cond").live("click",function(){
                    $("#source").attr("class","source_interface");
                    $(this).parent('div').children('div:eq(1)').attr("class","");
                    $('#id_div_txt').children('label').attr("cond","");                                      
                    $('#id_div_txt').children(':input').attr("cond","");  
                    $('#id_div_checkbox').children('label').attr("cond","");
                    $('#id_div_checkbox').children(':input').attr("cond","");
                    $('#id_div_radio').children('label').attr("cond","");
                    $('#id_div_radio').children(':input').attr("cond","");
                    $('#id_div_combo').children('label').attr("cond","");
                    $('#id_div_combo').children(':input').attr("cond","");
                    $('#id_div_mail').children('label').attr("cond","");
                    $('#id_div_mail').children(':input').attr("cond","");
                    $('#id_div_date').children('label').attr("cond","");
                    $('#id_div_date').children(':input').attr("cond","");
                    $('#id_div_form').children('label').attr("cond","");
                    $('#id_div_cond').children(':input').attr("cond","");
                    $('#id_div_cond').children('label').attr("cond","");
                    $('#id_div_txtarea').children(':input').attr("cond","");
                    $('#id_div_txtarea').children('label').attr("cond","");
                    $('#id_div_break').children('label').attr("cond","");
                    $('#id_div_id_select').children('label').attr("cond","");
                    $('#id_div_id_select').children(':input').attr("cond","");
                    $('#id_div_id_select').children(':input:eq(1)').attr("");
                    
                    
                });
              
                ///////////////////////////////////traitement des select/////////////////////////
                $(".table_select").live("change",function(){
                    var y=$(this).parent('div').children('select:eq(1)').attr("id");
                    $("#"+y).html("");
                    var x=$(this).val();
                    var y=$(this).parent('div').children('select:eq(1)').attr("id");
                   
                    $.post("recuperer_colone",{table_name:x},
                    function(data) {
                        $("#"+y).append(data);
                    });
                });
           
                ///////////////////////////////VALIDATION DES MODIFICATION/////////////////////
                
                //Validation des modification condition
                $(".valider_modif_cond").live("click",function(){               
                    var source_label=$(this).parent("div").children(":input:first").val();
                    var source_name=$(this).parent("div").children("input:eq(1)").val();
                    $(this).parent("div").parent("div").children("input#").attr("name",source_name);
                    $(this).parent("div").parent("div").children("label").text(source_label);
                   
                });
                
                //Validation des modification break
                $(".valider_modif_break").live("click",function(){               
                    var source_titre=$(this).parent("div").children(":input:first").val();
                    $(this).parent("div").parent("div").children("label").text(source_titre);
                   
                });
              
                //Validation des modification text
                $(".valider_modif_text").live("click",function(){
                    //contenu du champ text
                    var source_size=$(this).parent("div").children(":input:first").val();
                    var source_Label=$(this).parent("div").children("input:eq(1)").val();
                    var source_name=$(this).parent("div").children("input:eq(2)").val();

                    $(this).parent("div").parent("div").children("input#").attr("size",source_size);
                    $(this).parent("div").parent("div").children("input#").attr("name",source_name);
                    $(this).parent("div").parent("div").children("label").text(source_Label);

                    if ($(this).parent("div").children("input:eq(3)").is(':checked'))
                    {
                        $(this).parent("div").parent("div").children("input#").attr("req","oui");
                        $(this).parent("div").parent("div").children("label").attr("class","voir required");
                    }
                    else
                    {
                        $(this).parent("div").parent("div").children("input#").attr("req","non");
                        $(this).parent("div").parent("div").children("label").attr("class","voir");
                    }
                });
                
                //Validation des modification text area
                $(".valider_modif_area").live("click",function(){
                    //contenu du champ textarea
                    var source_label=$(this).parent("div").children(":input:first").val();
                    var source_cols=$(this).parent("div").children("input:eq(1)").val();
                    var source_rows=$(this).parent("div").children("input:eq(2)").val();
                  

                    $(this).parent("div").parent("div").children("label").text(source_label);
                    $(this).parent("div").parent("div").children("textarea").attr("cols",source_cols);
                    $(this).parent("div").parent("div").children("textarea").attr("rows",source_rows);

                    if ($(this).parent("div").children("input:eq(3)").is(':checked'))
                    {
                        $(this).parent("div").parent("div").children("textarea").attr("req","oui");
                        $(this).parent("div").parent("div").children("label").attr("class","voir required");
                    }
                    else
                    {
                        $(this).parent("div").parent("div").children("textarea").attr("req","non");
                        $(this).parent("div").parent("div").children("label").attr("class","voir");
                    }
                });


                //Validation des modification checkbox
                $(".valider_modif_checkbox").live("click",function(){
                    //contenu du champ checkbox

                    var source_label=$(this).parent("div").children(":input:first").val();
                    var source_name=$(this).parent("div").children("input:eq(1)").val();
                    $(this).parent("div").parent("div").children("input#").attr("name",source_name);
                    $(this).parent("div").parent("div").children("label").text(source_label);

                    if ($(this).parent("div").children("input:eq(2)").is(':checked'))
                    {
                        $(this).parent("div").parent("div").children("input#").attr("req","oui");
                        $(this).parent("div").parent("div").children("label").attr("class","voir required");
                    }
                    else
                    {
                        $(this).parent("div").parent("div").children("input#").attr("req","non");
                        $(this).parent("div").parent("div").children("label").attr("class","voir");
                    }
                });


                $(".valider_modif_checkbox").live("click",function(){
                    //contenu du champ checkbox

                    var source_label=$(this).parent("div").children(":input:first").val();
                    var source_name=$(this).parent("div").children("input:eq(1)").val();
                    $(this).parent("div").parent("div").children("input#").attr("name",source_name);
                    $(this).parent("div").parent("div").children("label").text(source_label);

                    if ($(this).parent("div").children("input:eq(2)").is(':checked'))
                    {
                        $(this).parent("div").parent("div").children("input#").attr("req","oui");
                        $(this).parent("div").parent("div").children("label").attr("class","voir required");
                    }
                    else
                    {
                        $(this).parent("div").parent("div").children("input#").attr("req","non");
                        $(this).parent("div").parent("div").children("label").attr("class","voir");
                    }
                });

                //Validation des modification date
                $(".valider_modif_date").live("click",function(){
                    //contenu du champ modif date
                    var source_label=$(this).parent("div").children(":input:first").val();                           
                    $(this).parent("div").parent("div").children("label").text(source_label);
                    if ($(this).parent("div").children("input:eq(1)").is(':checked'))                    {
                        $(this).parent("div").parent("div").children("input#").attr("req","oui");
                        $(this).parent("div").parent("div").children("label").attr("class","voir required");
                    }
                    else
                    {
                        $(this).parent("div").parent("div").children("input#").attr("req","non");
                        $(this).parent("div").parent("div").children("label").attr("class","voir");
                    }
                });

                //validate modif radio
                $(".valider_modif_radio").live("click",function(){
                    //contenu des modifications radio

                    var source_label=$(this).parent("div").children(":input:first").val();
                    var source_name=$(this).parent("div").children("input:eq(1)").val();
                    $(this).parent("div").parent("div").children("input#").attr("name",source_name);
                    $(this).parent("div").parent("div").children("label").text(source_label);

                    if ($(this).parent("div").children("input:eq(2)").is(':checked'))
                    {
                        $(this).parent("div").parent("div").children("input#").attr("req","oui");
                        $(this).parent("div").parent("div").children("label").attr("class","voir required");
                    }
                    else
                    {
                        $(this).parent("div").parent("div").children("input#").attr("req","non");
                        $(this).parent("div").parent("div").children("label").attr("class","voir");
                    }
                });
                
                //validate modif mail
                $(".valider_modif_mail").live("click",function(){
                    //contenu des modifications mail

                    var source_label=$(this).parent("div").children(":input:first").val();
                    $(this).parent("div").parent("div").children("label").text(source_label);

                    if ($(this).parent("div").children("input:eq(1)").is(':checked'))
                    {
                        $(this).parent("div").parent("div").children("input#").attr("req","oui");
                        $(this).parent("div").parent("div").children("label").attr("class","voir required");
                    }
                    else
                    {
                        $(this).parent("div").parent("div").children("input#").attr("req","non");
                        $(this).parent("div").parent("div").children("label").attr("class","voir");
                    }
                });
                //validate modif upload
                $(".valider_modif_upload").live("click",function(){
                    //contenu des modifications upload

                    var source_label=$(this).parent("div").children(":input:first").val();
                    var source_name=$(this).parent("div").children("input:eq(1)").val();
                    var source_type=$(this).parent("div").children("input:eq(2)").val();
                    
                    $(this).parent("div").parent("div").children("input#").attr("name",source_name);
                    $(this).parent("div").parent("div").children("input#").attr("type_file",source_type);
                    $(this).parent("div").parent("div").children("label").text(source_label);
                    
                    if ($(this).parent("div").children("input:eq(3)").is(':checked'))
                    {
                        $(this).parent("div").parent("div").children("input#").attr("req","oui");
                        $(this).parent("div").parent("div").children("label").attr("class","upload voir required");
                    }
                    else
                    {
                        $(this).parent("div").parent("div").children("input#").attr("req","non");
                        $(this).parent("div").parent("div").children("label").attr("class","upload voir");
                    }
                });
			
                //////////////////////////////////////SENDING TO DATA BASE/////////////////////////////////

				
                //Envoyer les données du formulaire 
                $("#send").live("submit",function(event){

                    event.preventDefault(); 
               
                    // re initialiser les cpt
                    cpt_text=0;
                    cpt_radio=0;
                    cpt_checkbox=0;
                    cpt_matrice=0;
                    cpt_cond=0;
                    cpt_comb=0;
                    cpt_mail=0;
                    cpt_date=0;
                    cpt_form=0;
                    cpt_area=0;
                    cpt_break=0;
                    cpt_id_s=0;
                    
                    // variable du champ text 
                    var val_label;
                    var attr_label;
                    var id_label="label_txt";
                    var id_text="text_id";
                    var name_txt="text_name";
                    var size_txt;
                    var req_txt;
                    var matrice_txt=new Array();


                    // variable du champ checkbox
                    var id_label_checkbox="label_checkbox";
                    var id_checkbox="checkbox_id";
		
                    // variable du champ radio
                    var id_label_radio="label_radio";
                    var id_radio="radio_id";
                
                    // variable du champ textarea  
                  
                    var id_label_area="label_area";
                    var id_area="area_id";
                   
                    // variable du champ condition 
                    var id_label_cond="label_cond";
                    var id_cond="cond_id";
                    
                    //variables du champ combo box
                    var id_label_comb="label_combo";
                    var id_comb="combo_id";
                    
                    //variables du champ email
                    var id_label_mail="label_mail";
                    var id_mail="mail_id";
                    
                    //Variables champ form
                    var id_label_form="label_form";                   
                    
                    // variables textarea
                    var id_area="area_id";
                    
                    //variable break
                    var id_label_break="label_break";    
                    
                    //variable select avance 
                    var id_table_menu="table_menu";
                    var id_colone_menu="colone_menu";
                    var label_id_select="label_id_select"
                    
                    
                    //variables du champ date 
                    var id_label_date="label_date";
                    var id_date="date_id";
                    
                    // parcourire les champs 
                    $(".champ").each(function(){	
                        var tab_txt=new Array();
                        cpt_matrice++;
                        //insertion d'un type text
                        if ($(this).children("div").attr("class")=="text_champ")
                        {
                            cpt_text++;
                            id_label=$(this).children("div").children("label").attr('id');
                            id_text=$(this).children("div").children(":input").attr('id');

                            val_label=$("#"+id_label).text();
                            class_label=$("#"+id_label).attr("class");

                            name_text=$("#"+id_text).attr("name");
                            size_txt=$("#"+id_text).attr("size");
                            req_text=$("#"+id_text).attr("req");
                            condition=$("#"+id_text).attr("cond");
                           
                            tab_txt[0]="text";
                            tab_txt[1]=id_label;
                            tab_txt[2]=val_label;
                            tab_txt[3]=class_label;
                            tab_txt[4]=name_text;
                            tab_txt[5]=size_txt;
                            tab_txt[6]=req_text;
                            tab_txt[7]=cpt_text;
                            tab_txt[8]=condition;
                                
                            matrice_txt[cpt_matrice-1]=tab_txt;
                            id_label="label_txt";
                            id_text="text_id";
                        }
                        //insertion des textarea
                        else if ($(this).children("div").attr("class")=="area_champ")
                        {
                            cpt_area++;
	
                            id_label_area=$(this).children("div").children("label").attr('id');
                            id_area=$(this).children("div").children(":input").attr('id');

                            val_label=$("#"+id_label_area).text();
                            class_label=$("#"+id_label_area).attr("class");
                            condition=$("#"+id_area).attr("cond");
                            cols=$("#"+id_area).attr("cols");
                            rows=$("#"+id_area).attr("rows");
                            req_area=$("#"+id_area).attr("req");

                            tab_txt[0]="area";
                            tab_txt[1]=id_label_area;
                            tab_txt[2]=val_label;
                            tab_txt[3]=class_label;
                            tab_txt[4]=rows;
                            tab_txt[5]=cols;
                            tab_txt[6]=req_area;
                            tab_txt[7]=cpt_area;
                            tab_txt[8]=condition;
                            
                            matrice_txt[cpt_matrice-1]=tab_txt;
                            id_label_area="label_area";
                            id_area="area_id";
                        }
                       
                        //insertion des checkbox 
                        else if ($(this).children("div").attr("class")=="checkbox_champ")
                        {
                            
                            cpt_checkbox++;
                            id_label_checkbox=$(this).children("div").children("label").attr('id');
                            id_checkbox=$(this).children("div").children(":input").attr('id');
                            val_label=$("#"+id_label_checkbox).text();
                            class_label=$("#"+id_label_checkbox).attr("class");
                            name_checkbox=$("#"+id_checkbox).attr("name");
                            req_checkbox=$("#"+id_checkbox).attr("req");
                            condition=$("#"+id_checkbox).attr("cond");
                           
                            tab_txt[0]="checkbox";
                            tab_txt[1]=id_label_checkbox;
                            tab_txt[2]=val_label;
                            tab_txt[3]=class_label;
                            tab_txt[4]=name_checkbox;
                            tab_txt[5]=req_checkbox;
                            tab_txt[6]=cpt_checkbox;
                            tab_txt[7]=condition;
                            
                            matrice_txt[cpt_matrice-1]=tab_txt;
                            id_label_checkbox="label_checkbox";
                            id_checkbox="checkbox_id";
                        }
                        //insersion des radio
                        else if ($(this).children("div").attr("class")=="radio_champ")
                        {
						
                            cpt_radio++

                            id_label_radio=$(this).children("div").children("label").attr('id');
                            id_radio=$(this).children("div").children(":input").attr('id');
                            val_label=$("#"+id_label_radio).text();
                            class_label=$("#"+id_label_radio).attr("class");
                            name_radio=$("#"+id_radio).attr("name");
                            req_radio=$("#"+id_radio).attr("req");
                            condition=$("#"+id_radio).attr("cond");
                            
                            tab_txt[0]="radio";
                            tab_txt[1]=id_label_radio;
                            tab_txt[2]=val_label;
                            tab_txt[3]=class_label;
                            tab_txt[4]=name_radio;
                            tab_txt[5]=req_radio;
                            tab_txt[6]=cpt_radio;
                            tab_txt[7]=condition;
                           
                            matrice_txt[cpt_matrice-1]=tab_txt;
                            id_label_radio="label_radio";
                            id_radio="radio_id";
                        }
			                        
                        //insersion des email
                        else if ($(this).children("div").attr("class")=="mail_champ")
                        {
						
                            cpt_mail++

                            id_label_mail=$(this).children("div").children("label").attr('id');
                            id_mail=$(this).children("div").children(":input").attr('id');
                            val_label=$("#"+id_label_mail).text();
                            class_label=$("#"+id_label_mail).attr("class");
                            req_mail=$("#"+id_mail).attr("req");
                            condition=$("#"+id_mail).attr("cond");
                            
                            tab_txt[0]="mail";
                            tab_txt[1]=id_label_mail;
                            tab_txt[2]=val_label;
                            tab_txt[3]=class_label;
                            tab_txt[4]=req_mail;
                            tab_txt[5]=cpt_mail;
                            tab_txt[6]=condition;
                           
                            matrice_txt[cpt_matrice-1]=tab_txt;
                            id_label_mail="label_mail";
                            id_mail="mail_id";
                        }
                        
                        // champ break
                        else if ($(this).children("div").attr("class")=="break_champ")
                        {
						
                            cpt_break++
                            id_label_break=$(this).children("div").children("label").attr('id');                         
                            val_label=$("#"+id_label_break).text();
                            class_break=$("#"+id_label_break).attr("class");
                            condition=$("#"+id_label_break).attr("cond");
                            
                            tab_txt[0]="break";
                            tab_txt[1]=id_label_break;
                            tab_txt[2]=val_label;
                            tab_txt[3]=class_break;                            
                            tab_txt[4]=cpt_break;
                            tab_txt[5]=condition;
                            
                            matrice_txt[cpt_matrice-1]=tab_txt;
                            id_label_break="label_break";
                           
                        }
                              
                        //insersion date
                        else if ($(this).children("div").attr("class")=="date_champ")
                        {						
                            cpt_date++

                            id_label_date=$(this).children("div").children("label").attr('id');
                            id_date=$(this).children("div").children(":input").attr('id');
                            val_label=$("#"+id_label_date).text();
                            class_label=$("#"+id_label_date).attr("class");
                            req_date=$("#"+id_date).attr("req");
                            condition=$("#"+id_date).attr("cond");
                           
                            tab_txt[0]="date";
                            tab_txt[1]=id_label_date;
                            tab_txt[2]=val_label;
                            tab_txt[3]=class_label;
                            tab_txt[4]=req_date;
                            tab_txt[5]=cpt_date;
                            tab_txt[6]=condition;
                           
                            matrice_txt[cpt_matrice-1]=tab_txt;
                            id_label_date="label_date";
                            id_date="date_id";
                        }
                        
                        // select avance 
                        else if ($(this).children("div").attr("class")=="id_select_champ")
                        {						
                            cpt_id_s++
                            id_table_menu=$(this).children("div").children('select').attr('id');
                            id_colone_menu=$(this).children("div").children('select:eq(1)').attr('id');
                            label_id_select=$(this).children("div").children("label").attr('id');
                            
                            table_get=$("#"+id_table_menu).val();
                            colone_get=$("#"+id_colone_menu).val();
                            class_get=$("#"+id_table_menu).attr("class");                        
                            condition=$("#"+id_table_menu).attr("cond");
                           
                            tab_txt[0]="select";
                            tab_txt[1]=label_id_select;
                            tab_txt[2]=class_get;
                            tab_txt[3]=table_get;
                            tab_txt[4]=colone_get;
                            tab_txt[5]=cpt_id_s;
                            tab_txt[6]=condition;
                           
                            matrice_txt[cpt_matrice-1]=tab_txt;
                            id_label_date="label_date";
                            id_table_menu="table_menu";
                            id_colone_menu="colone_menu";
                        }
                        
                        
                        // champ condition 
                
                        else if ($(this).children("div").attr("class")=="champ_cond")
                        {
                            cpt_cond++;
                            id_label_cond=$(this).children("div").children("label").attr('id');
                            id_cond=$(this).children("div").children(":input").attr('id');
                            val_label=$("#"+id_label_cond).text();
                            class_label=$("#"+id_label_cond).attr("class");
                            name_cond=$("#"+id_cond).attr("name");
                            class_cond=$("#"+id_cond).attr("class");
                            req_cond=$("#"+id_cond).attr("req");
                            condition=$("#"+id_cond).attr("cond");
                            
                            tab_txt[0]="cond";
                            tab_txt[1]=id_label_cond;
                            tab_txt[2]=val_label;
                            tab_txt[3]=class_label;
                            tab_txt[4]=name_cond;
                            tab_txt[5]=class_cond;
                            tab_txt[6]=req_cond;
                            tab_txt[7]=$("#"+id_cond).attr("num");       
                            tab_txt[8]=condition;
                         
                            matrice_txt[cpt_matrice-1]=tab_txt;
                            id_label_cond="label_cond";
                            id_cond="cond_id";
                        }
                    
                    
                        //combo boxes
                        else if ($(this).children("div").attr("class")=="combo_champ")
                        {
                            cpt_comb++;
                            id_label_comb=$(this).children("div").children("label").attr('id');
                            id_comb=$(this).children("div").children("select").attr('id');
                            val_label=$("#"+id_label_comb).text();
                            class_label=$("#"+id_label_comb).attr("class");
                            name_comb=$("#"+id_comb).attr("name");
                            class_comb=$("#"+id_comb).attr("class");
                            condition=$("#"+id_comb).attr("cond");
                          
                            var tab_select=new Array();
                           
                            $("#"+id_comb+" option" ).each(function(key,value){
                                tab_select[key]=$(this).val();                                                        
                            }); 
                            
                            tab_txt[0]="combo";
                            tab_txt[1]=id_label_comb;
                            tab_txt[2]=val_label;
                            tab_txt[3]=class_label;
                            tab_txt[4]=name_comb;
                            tab_txt[5]=class_comb;
                            tab_txt[6]=tab_select;
                            tab_txt[7]=cpt_comb;       
                            tab_txt[8]=condition;
                         
                            matrice_txt[cpt_matrice-1]=tab_txt;
                            id_label_comb="label_combo";
                            id_comb="combo_id";
                        }
                            
                    });
                    
                    var nom=$("#name_form").attr("value");
                    var edit=$("#edit").html();
                    $.post("recuperation",{ contenu :matrice_txt,form_name :nom,nb_champ :cpt_matrice,edit_code:edit},
                    
                    function(data) { 
                        /////////////////////// MESSAGE SUCCESS/ERROR SAVE ////////////////////////             
                  
                        if(data=="well done")            
                    
                        {                  
                            $.notifier.broadcast({
                     
                                ttl:'Saved ',
                                msg:'formulaire enregistrer!'
                            });
                            $("#boutton_fct").attr("style","visibility:hidden;");
                        }
                        else
                        {
                      
                            $.notifier.broadcast({
                     
                                ttl:'ERREUR',
                                msg:'formulaire non enregistrer!',
                                skin:'rounded,red'
	
                            });
                        }
                   
                    });
                });

                /////////////////////////////////////////TRAITEMENT DE LA FENETRE APERçu ////////////////////////////
                
                // apperçu 
                $("#boutton_appercu").live("click",function(){    
                    var i=0;
                    $(".voir").each(function(){
                        i++;
                        var res=$(this).clone();
                        $(".affich").attr("style","visibility:visible;");
                        $("#div-truc").append(res);
                     
                    })
                });
           
                //fermer apperç 
                $("#close").live("click",function(){
                    $(".affich").attr("style","visibility:hidden;");
                    $("#div-truc").html("");
                });
            });
            
        </script>
    </head>

    <body id="edit">

        <nav id="main-nav">
            <ul>
                <li class="home current" title="">
                    <a title="" href="/MVC"><img src="../views/image/loading.png"></a>
                    <ul>
                        <li>
                            <a title="admin" href="/MVC">Administration</a>
                        </li>
                        <li>
                            <a title="create" href="create">Creer formulaire</a>
                        </li>
                    </ul>
                </li>
            </ul>
        </nav>

        <!--barre d'action mobile-->

        <div id="status-bar">
            <a class="nav-button" title="Help" href="javascript:void(0)">
            </a>
        </div>
    
        <form id="send">
            <div id="control-bar" class="grey-bg clearfix fixed" style="opacity: 0.2;">
                <div class="container_12">
                    <div class="float-middle">
                        <button type="button" id="boutton_appercu">Appercu</button>
                        <button type="submit" id="boutton_fct">enregistrer</button>

                    </div>
                </div>
            </div>
        </form>

        <div id="DIV_MOVE" style="position: absolute; right: 100px; top: 120px;">
            <div class="block-border">
                <div class="arrowlistmenu" >
                    <!-- contenu champs simple_menu-->
                    <h3 class="menuheader expandable">Champs Simple</h3>
                    <ul class="categoryitems">

                        <?php
                        foreach ($input as $x) {

                            echo ($x->getTypeSimple());
                            echo'
<li><div style="z-index: 30;" class="drag' . $x->getTypeSimple() . '"><button type="button" id=Create_input_' . ($x->getTypeSimple()) . ' value=' . ($x->getTypeSimple()) . '><img src="../views/image/' . ($x->getTypeSimple()) . '.png"></button><img src="../views/image/drag.png"></div></li>';
                        }
                        ?>
                    </ul>
                    <!-- contenu champs_avance menu-->
                    <h3 class="menuheader expandable">Champs Avances</h3>
                    <ul class="categoryitems">
                        <?php
                        foreach ($get_avance as $y) {

                            echo $y->getTypeAvance();

                            echo'<li><div style="z-index: 30;" class="drag' . $y->getTypeAvance() . '"><button type="button" id=Create_input_' . ($y->getTypeAvance()) . ' value=' . ($y->getTypeAvance()) . '><img src="../views/image/' . ($y->getTypeAvance()) . '.png"></button><img src="../views/image/drag.png"></li>';
                        }
                        ?>
                    </ul>


                    <!-- pied du menu -->
                    <h3 class="menuheader" style="cursor: default">Ajouter un Input</h3>
                    <div>
                        Selectionnez des inputs simple ou bien avances .
                    </div>
                </div>
            </div>    

        </div>

    <center>
        <div style="position: absolute; left: 100px; top: 120px; z-index: 0" id="c">
            <form  class="block-content form" method="post" action="edit_vu.php" style="width:800">
                <p></p>
                <h1>Afficheur:</h1>
                <h3><label class="voir">Nom du Formulaire :</label></h3> <input type="text" id="name_form" value="Select a name" class="voir">
                <div class="source_interface sortable" id="source">
                </div>

                <!-- textarea-->
                <div id="txtarea" style="visibility:hidden;">
                    <fieldset class="grey-bg">
                        <div id="id_div_txtarea" class="area_champ">
                            <br>
                            <label id="label_area" class="" cond=""> Textarea: </label>
                            <textarea name= "area_name" id="area_id" cols="30" rows="2" req="non" class="" cond=""></textarea><br>
                            <button type="button" id="reduire" class="reduire_menu_edit">-</button><button type="button" id="boutton_edit_area" class="button_edit_area" >Editer</button><button class="red" id="supprimer">X</button>
                            <br>
                            <div id="edit_show_area">
                            </div>
                        </div>
                    </fieldset>
                </div>

                <!-- break-->
                <div id="break" style="visibility:hidden;">
                    <fieldset class="grey-bg">
                        <div id="id_div_break" class="break_champ">
                            <br>
                            <label id="label_break" class="" cond=""> Titre </label>
                            <hr>
                            <input type="hidden" id="input_break" class="" cond="">
                            <button type="button" id="reduire" class="reduire_menu_edit">-</button><button type="button" id="boutton_edit_break" class="button_edit_break" >Editer</button><button class="red" id="supprimer">X</button>
                            <br>
                            <div id="edit_show_break">
                            </div>
                        </div>
                    </fieldset>
                </div>

                <!-- text -->
                <div id="text" style="visibility:hidden;">                     
                    <fieldset class="grey-bg">
                        <div id="id_div_txt" class="text_champ">
                            <br>
                             <br>
                            <label id="label_txt" class=""> Text: </label>
                            <input type="text" size="10" name="text_name" id="text_id" req="non" class="" cond="">
                            <button type="button" id="reduire" class="reduire_menu_edit">-</button><button type="button" id="boutton_edit_text" class="button_edit_text" >Editer</button><button class="red" id="supprimer">X</button>
                            <br>
                            <div id="edit_show_text">
                            </div>
                        </div>
                    </fieldset> 
                    
                </div>

                <!--date -->
                <div id="date" style="visibility:hidden;">
                    <fieldset class="grey-bg">
                        <div id="id_div_date" class="date_champ">
                            <br> 
                            <label for="simple-calendar" id="label_date" class="">select Date </label>
                            <input id="date_id" class="" type="text" value="" req="non" cond="" name="date_name">
                            <button type="button" id="reduire" class="reduire_menu_edit">-</button><button type="button" id="boutton_edit_date" class="button_edit_date" >Editer</button><button class="red" id="supprimer">X</button>
                            <br>
                            <div id="edit_show_date">
                            </div>
                        </div>
                    </fieldset>
                </div>

                <!-- combo_boxes -->
                <div id="combo" style="visibility:hidden;">
                    <fieldset class="grey-bg">
                        <div id="id_div_combo" class="combo_champ">
                            <br>
                            <label id="label_combo" class=""> Choix: </label>
                            <select  name="combo_name" id="combo_id" req="non" class="" cond=""><option>-----</option></select>
                            <button type="button" id="reduire" class="reduire_menu_edit">-</button><button type="button" id="boutton_edit_combo" class="button_edit_combo" >Editer</button><button class="red" id="supprimer">X</button>
                            <br>
                            <div id="edit_show_combo">
                            </div>
                        </div>
                    </fieldset>
                </div>

                <!-- radio-->
                <div id="radio" style="visibility:hidden;">
                    <fieldset class="grey-bg">
                        <div id="id_div_radio"  class="radio_champ">
                            <br>
                            <label id="label_radio" class="" cond=""> Radio: </label>
                            <input type="radio" name="radio_name" id="radio_id" class="" cond="">
                            <button type="button" id="reduire" class="reduire_menu_edit">-</button>
                            <button type="button" class="boutton_edit_radio" >Editer</button><button id="supprimer" class="red">X</button>
                            <br>
                            <div id="edit_show_radio">
                            </div>
                        </div>
                    </fieldset>
                </div>

                <!-- checkboxes -->
                <div id="checkbox" style="visibility:hidden;">
                    <fieldset class="grey-bg">
                        <div id="id_div_checkbox"  class="checkbox_champ">
                            <label id="label_checkbox" class="" cond=""> checkbox </label>
                            <input type="checkbox" name="checkbox_name" id="checkbox_id"  req="non" class="" cond="">
                            <button type="button" id="reduire" class="reduire_menu_edit">-</button>
                            <button type="button" id="boutton_edit_checkbo" class="bouton_edit_checkbox">Editer</button><button id="supprimer" class="red">X</button>
                            <br>
                            <div id="edit_show_checkbox">
                            </div>
                        </div>
                    </fieldset>
                </div>

                <!-- champ mail -->
                <div id="email" style="visibility:hidden;">
                    <fieldset class="grey-bg">
                        <div id="id_div_mail"  class="mail_champ">
                            <label id="label_mail" class="" cond=""> e-mail</label>
                            <input type="text" name="mail_name" id="mail_id"  req="non" class="" cond="">
                            <button type="button" id="reduire" class="reduire_menu_edit">-</button>
                            <button type="button" id="boutton_edit_mail" class="bouton_edit_mail">Editer</button><button id="supprimer" class="red">X</button>
                            <br>
                            <div id="edit_show_mail">
                            </div>
                        </div>
                    </fieldset>
                </div>

                <!-- champ conditionnel -->
                <div id="conditionnel" style="visibility:hidden;">
                    <fieldset class="grey-bg">
                        <div id="id_div_cond"  class="champ_cond">
                            <label id="label_cond" class="" num=""> Choisir une question :</label>
                            <input type="checkbox" name="cond_name" id="cond_id" req="non" class="cond" cond="" num="">
                            <button type="button" id="reduire" class="reduire_menu_cond">-</button>
                            <button type="button" id="boutton_edit_cond" class="bouton_edit_cond">Editer</button>
                            <button class="Ajout_cond grey" type="button">Activer ajout</button>
                            <button class="desactiver_cond grey" type="button">desactiver ajout</button><button id="supprimer" class="red">X</button>
                            <br>
                            <div class="edit_show_cond">

                            </div>
                            <div id="conditions" class=""></div>

                        </div>
                    </fieldset>
                </div>

                <!-- other form -->
                <div id="form" style="visibility:hidden;">
                    <fieldset class="grey-bg">
                        <div id="id_div_form" class="form_champ">
                            <br>                                    
                            <label id="label_form" class="" cond=""> Ajouter formulaire </label>
                            <select class="form_select" cond="" style="display:inline;">  <?php
                        foreach ($get_name as $x) {
                            echo'<option>' . $x->getFormName() . '</option>';
                        }
                        ?> </select>
                            <button class="grey call_forms" style="display:inline;">Extraire</button> 
                            <button class="red" id="supprimer">X</button>
                            <br>
                            <div id="edit_show_form">
                            </div>
                        </div>
                    </fieldset>
                </div>

                <!-- id_selector -->
                <div id="id_select" style="visibility:hidden;">
                    <fieldset class="grey-bg">
                        <div id="id_div_id_select" class="id_select_champ">
                            <br>                                    
                            <label id="label_id_select" class="" cond=""> Selectionner la table </label>
                            <select id="table_menu" class="table_select" cond="" style="display:inline;"> 
                                <option>-----</option>
                                <?php
                                mysql_connect("localhost", "root");
                                mysql_select_db("dynamic");

                                $req = "show tables";
                                $result = mysql_query($req);
                                while ($ligne = mysql_fetch_array($result)) {
                                    echo "<option value='" . $ligne[0] . "'>" . $ligne[0] . "</option>";
                                }
                                ?>
                            </select>
                            <select id="colone_menu" class="colone_select" cond="">

                            </select>
                            <button class="red" id="supprimer">X</button>
                            <br>
                            <div id="edit_show_form">
                            </div>

                        </div>
                    </fieldset>
                </div>
                <!-- modal window -->
                <div class="affich" style="visibility:hidden;">
                    <div id="simple-modal" class="simple-modal draggable block-border" style="width: 400px; top: 40px; left: 431px;">
                        <div class="simple-modal-header" style="cursor: move;">
                            <button type="button" id="close" class="red">x</button>
                        </div>
                        <div class="simple-modal-body">
                            <div id="div-truc">
                                <p>
                                </p>
                            </div>
                        </div>
                    </div>
                </div>
       </form>
        </div>
    </center>

    <!-- interface edit break-->
    <div id="interface_edit_break" style="visibility:hidden" >
        <br />Titre : <input type="text" id="source_label_break"/>       
        <button class="valider_modif_break grey" type="button">VALIDER</button>
    </div>

    <!-- interface edit text-->
    <div id="interface_edit_txt" style="visibility:hidden ;z-index: 100">
        <br />Taille : <input type="text" value="5" id="source_taille" />
        <br />Label : <input type="text" value="Text" id="source_label_text"/>
        <br> Name  : <input type="text" id="source_nom_txt">
        <br /><br />
        <u>Regles :</u> <br />
        Obligatoire :<input type="checkbox" id="source_required_t"/>
        <br />
        <button class="valider_modif_text grey" type="button">VALIDER</button>
    </div>

    <!-- interface edit checkbox-->
    <div id="interface_edit_checkbox" style="visibility:hidden" >
        <br />Label : <input type="text" value="checkbox" id="source_label_checkbox"/>
        <br> Name  : <input type="text" id="source_nom_checkbox">
        <br /><br />
        <u>Regles :</u> <br />
        Obligatoire :<input type="checkbox" id="source_required_chk" name="c"/>
        <br />
        <button class="valider_modif_checkbox grey" type="button">VALIDER</button>
    </div>

    <!-- interface edit radio-->
    <div id="interface_edit_radio" style="visibility:hidden" >
        <br />Label : <input type="text" value="Radio" id="source_label_radio"/>
        <br> Name  : <input type="text" id="source_nom_radio">
        <br /><br />
        <u>Regles :</u> <br />
        Obligatoire :<input type="checkbox" id="source_required_rad"/>
        <br />
        <button class="valider_modif_radio grey" type="button">VALIDER</button>
    </div>

    <!-- interface edit mail-->
    <div id="interface_edit_mail" style="visibility:hidden" >
        <br />Label : <input type="text" value="@mail" id="source_label_mail"/>
        <br /><br />
        <u>Regles :</u> <br />
        Obligatoire :<input type="checkbox" id="source_required_mail"/>
        <br />
        <button class="valider_modif_mail grey" type="button">VALIDER</button>
    </div>

    <!-- interface edit cond-->
    <div id="interface_edit_cond" style="visibility:hidden" >
        <br />Label : <input type="text" value="choisir condition :" id="source_label_cond"/>
        <br> Name  : <input type="text" id="source_nom_cond">
        <br /><br />        
        <button class="valider_modif_cond grey" type="button">VALIDER</button>

    </div>

    <!-- interface edit date-->
    <div id="interface_edit_date" style="visibility:hidden" >
        <br />Label : <input type="text" value="occasion :" id="source_label_date"/>
        <br /><br /> 
        <u>Regles :</u> <br />
        Obligatoire :<input type="checkbox" id="source_required_date"/>
        <br />
        <button class="valider_modif_date grey" type="button">VALIDER</button>
    </div>

    <!-- interface edit textarea-->
    <div id="interface_edit_area" style="visibility:hidden" >
        <br />Label : <input type="text" value="Label :" id="source_label_area"/>
        <br />
        cols :<input type="text" id="source_cols_area"/>
        <br /> 
        rows :<input type="text" id="source_rows_area"/>
        <br /> 
        <u>Regles :</u> <br />
        Obligatoire?:<input type="checkbox" id="source_required_rows"/>
        <br />
        <button class="valider_modif_area grey" type="button">VALIDER</button>
    </div>

    <!-- interface edit combo boxes -->
    <div id="interface_edit_combo" style="visibility:hidden" >
        <br />Label : <input type="text" value="choisir le choix :" id="source_label_combo"/>

        <button type="button"  class="red add_combo" style="display:inline;"><img src="../views/image/plus.png"></button> 
        <button type="button"  class="red del_combo" style="display:inline;"><img src="../views/image/delete.png"></button> 

        <div class="source_added_combo">
        </div>
        <br /><br />    
        <br /><br /><button class="valider_modif_combo grey" type="button">VALIDER</button>
    </div>

    <!-- interface combo added -->

    <div id="interface_added" style="visibility:hidden" >
        <div>
            <input type="text" size="10" class="added_combo" added="non" id="">
            <button class="red min_combo" style="display:inline;"><img src="../views/image/moin.png"> </button>
        </div>
    </div>


    <!-- pied de page -->
    <footer>
        <div class="float-right">
            <a class="button" href="#top">
                <img width="16" height="16" src="../views/image/up.png">
                Page top
            </a>
        </div>
    </footer>

</body>
</html>


